﻿
module Sustainalytics.Portfolio {

    import Common = Sustainalytics.Common;
    import SearchBox = Sustainalytics.SearchBox;
    export interface IPortfolioSearchBoxService {
        // Search for items given a term and paging options
        Search(searchData: any, skip: number, take: number): ng.IHttpPromise<any[]>;
    }
    export class PortfolioSearchBoxServiceAdapter implements IPortfolioSearchBoxService
    {

        private portfolioSearchService: PortfolioSearchService;

        public constructor($http: ng.IHttpService, $rootScope: ng.IScope, $q: ng.IQService) {

            this.portfolioSearchService = new Sustainalytics.Portfolio.PortfolioSearchService($http, $rootScope,$q);
        }

        public Search(searchData: any, skip: number, take: number): ng.IHttpPromise<any[]> {
            var lstPromise: ng.IHttpPromise<PortfolioDto[]> = this.portfolioSearchService.SearchPortfolio(searchData, skip, take);
            return lstPromise;
        }
    }

    var portfolioSearchModule = angular.module(portfolioModuleName);

    portfolioSearchModule.service('PortfolioSearchBoxServiceAdapter',
        ['$http', '$rootScope', '$q', PortfolioSearchBoxServiceAdapter]);


  
}